#_*_ coding:UTF-8 _*_
__author__ = 'shaowei'

import os
import HandleXcodeBuild
import string
import sys

default_work_path = "~/Git/PushPrompt"  # 默认的project根目录

# def check_input_bool(default_path):
# 	prompt_input = "是否开始编译默认项目-  " + default_path + " ; yes or no :"
# 	while True:
# 		user_input = raw_input(prompt_input)
# 		user_input = user_input.lower()
# 		if user_input == "yes":
# 			return True
# 		elif user_input == "no":
# 			return False
# 		else:
# 			print "only input 'yes' or 'no', please input again " + user_input
#
# default_work_path = "~/Git/PushPrompt"
#
# work_path = raw_input("please project root folder path:\n")
# if os.path.isdir(os.path.expanduser(work_path)):
# 	print "start build:", work_path
# else:
# 	print "路径：", work_path, "不存在"
# 	user_select = check_input_bool(default_work_path)
# 	if user_select:
# 		work_path = default_work_path
# 	else:
# 		sys.exit()  # 退出程序
#
# work_path = os.path.expanduser(work_path)
#
# #切换到工作目录
# os.chdir(work_path)
#
# params = HandleXcodeSetting.handle_string()
#
# path_params = {}
# for key in params:
# 	value = params[key]
# 	if string.find(value, "fygoijpftcufifdfzfndmdhcxmir") != -1:
# 		path_params[key] = value
#
#
# # output
# for key, value in path_params.items():
# 	print value, " : ", key

import commands

work_path = os.path.expanduser(default_work_path)
os.chdir(work_path)
shell_build_list = "xcodebuild -list"

status, output = commands.getstatusoutput(shell_build_list)
arr_param = output.split("\n")

start_get = False
for item in arr_param:
	item_strip = item.strip()
	# print len(item_strip), ":", item
	if start_get:
		if len(item_strip) == 0:
			break
		else:
			print "p:", item_strip
	else:
		if item_strip.startswith("Build Configurations"):
			start_get = True



sys.exit()
